import {isEmpty, resetState} from '@/utils/index';
import {mapState, mapGetters, mapMutations, mapActions} from 'vuex';
import MineService from '@/services/mine/index';
const mineService = new MineService();
/*
页面的混合
 */
var page = {
    data(){
      return {
        code:''
      }
    },
    methods:{
        save(){
          //  判断personalInfo的value值
          //postUserGradleResult
              console.log("value:",this.personalInfo)
              if(this.personalInfo.find(s=>isEmpty(s.gradevalue)||isEmpty(s.title))!=undefined){
                uni.showToast({
                    title: '请按正确的格式录入成绩！',
                    duration: 2000,
                    icon:'none'
                });
                return;
              }
              mineService.postUserGradleResult(
                {personalInfo:this.personalInfo,code:this.code}
                ).then(resultDto=>{
                  if(resultDto.success){
                    console.log('sssss')
                    uni.showToast({
                        title: '修改成绩成功',
                        duration: 2000
                    });
                  }
                });
          },
        inputVal(e){
            const {value} = e.detail;
            if(value<0 || value>100){
                  uni.showToast({
                      title: '输入成绩格式不正确',
                      duration: 2000,
                      icon:'none'
                  });
                  return;
                }
            },
          judgeVal(item){
            if(item.gradevalue<0 || item.gradevalue>100){
                  uni.showToast({
                      title: '输入成绩格式不正确',
                      duration: 2000,
                      icon:'none'
                  });
                  item.gradevalue = 0;
                  return;
                }
            item.gradevalue = Number.parseFloat(item.gradevalue).toFixed(1);
          }
    }
};
export default page;